<?php
/* 
 * Linonline - OpenSource
 *
 *  This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */

/**
 * Description of EngineClass
 *  This is the basic class, that will be inherited by others.
 *  It contains the basic variables and methods of login and rendering.
 *
 * Prefefined Vars:
 *  $config -- Config Array (Config.php)
 *  $db -- DataBase Class Connector (index.php)
 *
 * @author Josi
 */
class Engine {
    public $version, $project, $db, $content, $topPanel, $lastPage;

    public function get_version(){
        global $config;
        $this->version = $config['version'];
    }
    public function get_project(){
        global $config;
        $this->project = $config['project'];
    }
    public function get_lastPage(){
        $this->lastPage = $_COOKIE['lastPage'];
        if(!$this->lastPage){
            $this->lastPage = "Intro";
        }
    }
    public function render(){
        // To simplify code lets put html stuff inside html files in the html folder.
        // This method will be overriden... and content will change.
        // If not overriden then will load Intro page.
        global $player;
        $this->content = $this->lastPage;
        if($player->authLevel > 0)
            $this->topPanel = "Stats";
        else
            $this->topPanel = "Login";
        include("html/Page.php");
    }

    public function Engine(){
        // Runs when an instance is called.
        $this->get_version();
        $this->get_project();
        $this->get_lastPage();
    }
}
?>
